package club.caihappy.springsecurity.controller;

import club.caihappy.springsecurity.pojo.ResponseResult;
import club.caihappy.springsecurity.pojo.User;
import club.caihappy.springsecurity.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Patrick on 2022/9/6
 **/
@RestController
@RequestMapping("user")
public class LoginController {

    @Autowired
    private IUserService userService;


    @PostMapping("login")
    public ResponseResult login(@RequestBody User user) {
        return userService.login(user);
    }

    @RequestMapping("logout")
    public ResponseResult logout() {
        return userService.logout();
    }

}
